package ioc04;

/**
 * Author：汤小洋
 * Date：2022-11-22 14:52
 * Description：<描述>
 */
public class SpringBean {

    {
        System.out.println("代码块。。。。。。。。。。。。");
    }

    private OtherBean otherBean;

    public SpringBean() {
        System.out.println("实例化。。。。。。。。。。。");
    }

    public OtherBean getOtherBean() {
        return otherBean;
    }

    public void setOtherBean(OtherBean otherBean) {
        System.out.println("数据装配。。。。。。。。。。");
        this.otherBean = otherBean;
    }

    @Override
    public String toString() {
        return "SpringBean{" +
                "otherBean=" + otherBean +
                '}';
    }

    public void init(){
        otherBean.setSex(otherBean.getSex().toUpperCase());
    }

    public void destroy(){
        System.out.println("bean销毁。。。。。。");
    }
}
